PROGRAM impact
IMPLICIT NONE
REAL :: m1,m2,e,r1,r2,d,tan_a,beta
REAL,PARAMETER :: PI=3.14159265359

WRITE (*,*), 'Enter mass of moving sphere (m1):'; READ *, m1  ! Reading the values from the user
WRITE (*,*), 'Enter mass of stationary sphere (m2)::'; READ *, m2
WRITE (*,*), 'Enter the constant of restitution (e):'; READ *, e
WRITE (*,*), 'Enter the radius of moving sphere (r1):'; READ *, r1
WRITE (*,*), 'Enter the radius of stationary sphere (r2):'; READ *, r2
WRITE (*,*), 'Enter the impact parameter (d):'; READ *, d

tan_a=TAN(ASIN(d/(r1+r2)))

beta = ATAN( (m2*(1+e)*tan_a)/(m1 - e*m2 + (m1+m2)*tan_a*tan_a) )
beta = beta*180/Pi
WRITE (*,*),'Angle of deflection (in degree)',beta

END PROGRAM

